﻿@model LynxWebLog.Areas.Pages.ViewModels.PageEntry

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>


@using (Html.BeginForm("Edit", "PageEntry", FormMethod.Post)) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset class="form-horizontal">
        <legend>Page Entry</legend>
        <div class="row">
            <div class="col-sm-2 col-md-2 col-lg-2">
                <div class="form-group">
                    @Html.LabelFor(model => model.pd.pageid, new { @class = "control-label", disabled = "disabled" })
                                <div class="controls">
                                    <input type="text" id="pdd_postid" name="pd.postid" class="form-control input-sm" value="0" disabled="disabled" />
                                    @Html.ValidationMessageFor(model => model.pd.pageid, null, new { @class = "help-inline" })
                                    @Html.HiddenFor(model => model.pd.pageid)
                                            </div>
                                        </div>
            </div>
            <div class="col-sm-offset-1 col-md-offset-1 col-lg-offset-1 col-sm-5 col-md-5 col-lg-4">
                <div class="form-group">
                    @Html.LabelFor(model => model.pd.blogid, new { @class = "control-label" })
                                <div class="controls">
                                    <input type="text" id="pdd_blogid" name="pd.blogid" class="form-control input-sm" value="@Model.pd.blogid" disabled="disabled" />
                                    @Html.HiddenFor(model => model.pd.blogid)
                                    @Html.ValidationMessageFor(model => model.pd.blogid, null, new { @class = "help-inline" })
                                            </div>
                                        </div>
                </div>
            <div class="col-sm-offset-1 col-md-offset-1 col-lg-offset-1 col-sm-3 col-md-3 col-lg-4">
                <div class="form-group">
                    @Html.LabelFor(model => model.pd.license, new { @class = "control-label" })
                            <div class="controls">
                                @Html.DropDownListFor(model => model.pd.license, (List<SelectListItem>)ViewBag.License, "", new { @class = "form-control input-sm" })
                                        @Html.ValidationMessageFor(model => model.pd.license, null, new { @class = "help-inline" })
                                            </div>
                                        </div>
                                    </div>
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.pd.title, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextBoxFor(model => model.pd.title, new { @class = "form-control input-sm" })
                        @Html.ValidationMessageFor(model => model.pd.title, null, new { @class = "help-inline" })
                        </div>
                    </div>

        <div class="form-group">
            @Html.LabelFor(model => model.pd.description, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextAreaFor(model => model.pd.description, new { @class = "ckeditor form-control", rows = "20" })
                        @Html.ValidationMessageFor(model => model.pd.description, null, new { @class = "help-inline" })
                        </div>
                    </div>
        <div class="row">
        <div class="col-sm-3 col-md-3 col-lg-3">
        <div class="form-group">
            @Html.LabelFor(model => model.pd.wp_page_parent_id, new { @class = "control-label" })
            <div class="controls">
                @Html.TextBoxFor(model => model.pd.wp_page_parent_id, new { @class = "form-control input-sm" })
                @Html.ValidationMessageFor(model => model.pd.wp_page_parent_id, null, new { @class = "help-inline" })
            </div>
        </div>
        </div>
            <div class="col-sm-offset-1 col-md-offset-1 col-lg-offset-1 col-sm-2 col-md-2 col-lg-2">
                <div class="form-group">
                    @Html.LabelFor(model => model.pd.wp_page_order, new { @class = "control-label" })
                            <div class="controls">
                                @Html.TextBoxFor(model => model.pd.wp_page_order, new { @class = "form-control input-sm" })
                                        @Html.ValidationMessageFor(model => model.pd.wp_page_order, null, new { @class = "help-inline" })
                                            </div>
                                        </div>
                                    </div>
            <div class="col-sm-offset-1 col-md-offset-1 col-lg-offset-1 col-sm-1 col-md-1 col-lg-1">
                <div class="form-group">
                    @Html.LabelFor(model => model.pd.IsPublished, new { @class = "control-label" })
                            <div class="controls">
                                @Html.EditorFor(model => model.pd.IsPublished)
                                        @Html.ValidationMessageFor(model => model.pd.IsPublished, null, new { @class = "help-inline" })
                                            </div>
                                        </div>
                                    </div>
            <div class="col-sm-offset-1 col-md-offset-1 col-lg-offset-1 col-sm-3 col-md-3 col-lg-3">
                <div class="form-group">
                    @Html.LabelFor(model => model.pd.DateCreated, new { @class = "control-label" })
                            <div class="controls">
                                @if ((bool)ViewBag.LegacyBrowser) {
                                    @Html.TextBoxFor(model => model.dateCreatedString, new { @class = "form-control input-sm" })
                                } else {
                                @Html.EditorFor(model => model.pd.DateCreated)
                                        @Html.ValidationMessageFor(model => model.pd.DateCreated, null, new { @class = "help-inline" })
                                }
                                            </div>
                                        </div>
                                    </div>
        </div>
        <div class="form-actions">
            <input type="submit" value="Save" class="btn btn-default btn-primary" />
        </div>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script>

        CKEDITOR.replace('editor1', {
            /*
             * Font face.
             */

            // List of fonts available in the toolbar combo. Each font definition is
            // separated by a semi-colon (;). We are using class names here, so each font
            // is defined by {Combo Label}/{Class Name}.
            font_names: 'Comic Sans MS/FontComic;Courier New/FontCourier;Times New Roman/FontTimes',

            // Define the way font elements will be applied to the document. The "span"
            // element will be used. When a font is selected, the font name defined in the
            // above list is passed to this definition with the name "Font", being it
            // injected in the "class" attribute.
            // We must also instruct the editor to replace span elements that are used to
            // set the font (Overrides).
            font_style: {
                element: 'span',
                attributes: { 'class': '#(family)' },
                overrides: [
                    {
                        element: 'span',
                        attributes: {
                            'class': /^Font(?:Comic|Courier|Times)$/
                        }
                    }
                ]
            },

            /*
             * Font sizes.
             */
            fontSize_sizes: 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',
            fontSize_style: {
                element: 'span',
                attributes: { 'class': '#(size)' },
                overrides: [
                    {
                        element: 'span',
                        attributes: {
                            'class': /^Font(?:Smaller|Larger|Small|Big|Double)$/
                        }
                    }
                ]
            },

            /*
             * Font colors.
             */
            colorButton_enableMore: false,

            colorButton_colors: 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',
            colorButton_foreStyle: {
                element: 'span',
                attributes: { 'class': '#(color)' },
                overrides: [
                    {
                        element: 'span',
                        attributes: {
                            'class': /^FontColor(?:1|2|3)$/
                        }
                    }
                ]
            },

            colorButton_backStyle: {
                element: 'span',
                attributes: { 'class': '#(color)BG' },
                overrides: [
                    {
                        element: 'span',
                        attributes: {
                            'class': /^FontColor(?:1|2|3)BG$/
                        }
                    }
                ]
            },

            /*
             * Indentation.
             */
            indentClasses: ['Indent1', 'Indent2', 'Indent3'],

            /*
             * Paragraph justification.
             */
            justifyClasses: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull']

            /*
             * Styles combo.
             */
            //stylesSet: [
            //    { name: 'Strong Emphasis', element: 'strong' },
            //    { name: 'Emphasis', element: 'em' },

            //    { name: 'Computer Code', element: 'code' },
            //    { name: 'Keyboard Phrase', element: 'kbd' },
            //    { name: 'Sample Text', element: 'samp' },
            //    { name: 'Variable', element: 'var' },

            //    { name: 'Deleted Text', element: 'del' },
            //    { name: 'Inserted Text', element: 'ins' },

            //    { name: 'Cited Work', element: 'cite' },
            //    { name: 'Inline Quotation', element: 'q' }
            //]
        });

    </script>
}
